#include <iostream>
#include <vector>

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> array(n);
    for (int i = 0; i < n; ++i) {
        cin >> array[i];
    }
    for(int i = 1; i<n;i++){
        if(array[i]>0 and array[i-1]>0 or array[i]<0 and array[i-1]<0){
            if(array[i]<array[i-1]){
                cout << array[i] << " " << array[i - 1];
                break;
            }
            if(array[i]>array[i-1]){
                cout << array[i-1] << " " << array[i];
                break;
            }
        }
    }

}